﻿@{
    Layout = null;
    ViewBag.Title = "Index";
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Trabajos en proceso</title>

    <script type='text/javascript' src='~/Content/assets/js/jquery-1.10.2.min.js'></script>
    <script type='text/javascript' src='~/Content/assets/js/jqueryui-1.10.3.min.js'></script>
    <script type='text/javascript' src='~/Content/assets/js/bootstrap.min.js'></script>

    <link rel="stylesheet" href="~/Content/assets/css/styles.min.css" />
    <link rel="stylesheet" href="~/Content/assets/css/styleCustom.css" />
    <link rel='stylesheet' type='text/css' href='~/Content/assets/js/jqueryui.css' />
    <link rel='stylesheet' type='text/css' href='~/Content/assets/plugins/pines-notify/jquery.pnotify.default.css' />

    @Scripts.Render("~/bundles/jqueryval")

    <script language="javascript" type="text/javascript">
        $(function () {
            $("#btn").click(function () {
                if (confirm("Desea pausar el trabajo actual?")) {
                    return true;
                } else {
                    return false;
                }

            });
            $("#btnTerminar").click(function () {
                if (confirm("Desea TERMINAR el trabajo actual?")) {
                    return true;
                } else {
                    return false;
                }

            });
            $("#btnPausar").click(function () {
                if (confirm("Desea REANUDAR el trabajo actual?")) {
                    return true;
                } else {
                    return false;
                }

            });
            
        });

    </script>

</head>
<body class="focusedform">

    <div class="centradovertical">
        <img src="~/Content/assets/img/Logo-Aexo.png" alt="Logo" class="brand" />
        @if (ViewData.ModelState.Keys.Any(k => ViewData.ModelState[k].Errors != null && ViewData.ModelState[k].Errors.Count() > 0))
        {
            <div class="alert alert-dismissable alert-danger">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                @Html.ValidationSummary("Error!")
            </div>
        }
        <div class="panel panelCentrado panel-primary">
            @using (Html.BeginForm("RegistroTiempos", "Produccion", FormMethod.Post, new { @id = "formRegistro", @class = "form-horizontal" }))
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)

                <div class="panel-body">
                    <h4 class="text-center" style="margin-bottom: 25px;">Trabajos en Proceso</h4>

                    <div class="form-group">
                        <div class="col-sm-12">
                            <div class="panel panel-primary" style="width:100%">
                                <div class="panel-heading">
                                    <h4>
                                        <ul class="nav nav-tabs">
                                            <li class="active"><a href="#home11" data-toggle="tab">Iniciados</a></li>
                                            <li><a href="#profile11" data-toggle="tab">Pausados</a></li>
                                        </ul>
                                    </h4>
                                    <div class="options">

                                    </div>
                                </div>
                                <div class="panel-body">
                                    <div class="tab-content">
                                        <div class="tab-pane active" id="home11">
                                            @if (ViewBag.TrabajosIniciados.Count == 0)
                                            {
                                                <div class="alert alert-dismissable alert-info">
                                                    <strong>No existen trabajos iniciados</strong>
                                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                                </div>
                                            }
                                            else
                                            {
                                                <table class="table table-striped">
                                                    <thead>
                                                        <tr>
                                                            <th>#</th>
                                                            <th>Empleado</th>
                                                            <th>Proceso</th>
                                                            <th>Partes</th>
                                                            <th>Cantidad</th>
                                                            <th>Inicio</th>
                                                            <th></th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        @foreach (var item in ViewBag.TrabajosIniciados)
                                                        {
                                                            <tr>
                                                                <td>@item.IdRegistroProceso</td>
                                                                <td>@item.Empleado.NombreCompleto</td>
                                                                <td>@item.Proceso.Descripcion</td>
                                                                <td>@item.Parte.Descripcion</td>
                                                                <td>@item.Cantidad</td>
                                                                <td>@item.Inicio</td>
                                                                <td>
                                                                    @Html.ActionLink("Pausar", "Pausar", "Produccion", new { id = @item.IdRegistroProceso }, new { @class = "btn btn-default btn-sm", @id = "btn" })
                                                                    @Html.ActionLink("Terminar", "Terminar", "Produccion", new { id = @item.IdRegistroProceso }, new { @class = "btn btn-danger btn-sm", @id = "btnTerminar" })
                                                                </td>
                                                        </tr>
                                                        }
                                                    </tbody>
                                                </table>
                                            }
                                        </div>
                                        <div class="tab-pane" id="profile11">
                                            @if (ViewBag.TrabajosPausados.Count == 0)
                                            {
                                                <div class="alert alert-dismissable alert-info">
                                                    <strong>No existen trabajos Pausados</strong>
                                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                                </div>
                                            }
                                            else
                                            {
                                                <table class="table table-striped">
                                                    <thead>
                                                        <tr>
                                                            <th>#</th>
                                                            <th>Empleado</th>
                                                            <th>Proceso</th>
                                                            <th>Partes</th>
                                                            <th>Cantidad</th>
                                                            <th>Inicio</th>
                                                            <th></th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        @foreach (var item in ViewBag.TrabajosPausados)
                                                        {
                                                            <tr>
                                                                <td>@item.IdRegistroProceso</td>
                                                                <td>@item.Empleado.NombreCompleto</td>
                                                                <td>@item.Proceso.Descripcion</td>
                                                                <td>@item.Parte.Descripcion</td>
                                                                <td>@item.Cantidad</td>
                                                                <td>@item.Inicio</td>
                                                                <td>
                                                                    @Html.ActionLink("Reanudar", "Reanudar", "Produccion", new { id = @item.IdRegistroProceso }, new { @class = "btn btn-default btn-sm", @id = "btn" })
                                                                </td>
                                                            </tr>
                                                        }
                                                    </tbody>
                                                </table>
                                            }
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-footer">
                    <div class="pull-right">
                        <input type="submit" id="btnSubmit" class="btn-primary btn" value="Registrar">
                    </div>
                </div>
            }

        </div>
    </div>
</body>

</html>